package com.cheung.leetcode.normal;

import lyroot.entity.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class LC94 {
    public static List<Integer> inorderTraversal(TreeNode root) {
        ArrayList<Integer> result = new ArrayList<>();
        f(root, result);
        return result;
    }


    private static void f(TreeNode root, List<Integer> result) {
        if (root != null) {
            f(root.left, result);
            result.add(root.val);
            f(root.right, result);
        }
    }

    public static void main(String[] args) {

        TreeNode t1 = new TreeNode(1);
        TreeNode t2 = new TreeNode(2);
        TreeNode t3 = new TreeNode(3);

        t1.right = t2;
        t2.left = t3;

        System.out.println(inorderTraversal(null));

    }
}
